import { PageReq, PageRes } from '@/api/types'
import request from '@/utils/request'
import { AllocateModel } from '@/api/model/allocate-model'

// 获取调拨列表
export function allocatePageApi(data: PageReq<Partial<any>>) {
  return request<PageRes<any>>({
    url: '/allocate/page',
    method: 'post',
    data
  })
}

// 新增调拨
export function addAllocateApi(data: Partial<AllocateModel>) {
  return request({
    url: '/allocate/add',
    method: 'post',
    data
  })
}

// 更新调拨
export function editAllocateApi(data: Partial<AllocateModel & { id: number }>) {
  return request({
    url: '/allocate/edit',
    method: 'post',
    data
  })
}

// 删除调拨
export function delAllocateApi(data: { id: number }) {
  return request({
    url: '/allocate/del',
    method: 'post',
    data
  })
}

// 获取调拨列表
export function getAllocateListApi(data: { isInStore: boolean }) {
  return request({
    url: '/allocate/getAllocateList',
    method: 'post',
    data
  })
}

// 获取调拨详情
export function getAllocateDetailApi(data: { id: number }) {
  return request({
    url: '/allocate/getAllocateDetail',
    method: 'post',
    data
  })
}
